package com.alignet.gn.hibernate;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToMany;
import javax.persistence.Transient;

/**
 * AbstractTgnUser entity provides the base persistence definition of the
 * TgnUser entity. @author MyEclipse Persistence Tools
 */
@MappedSuperclass
public abstract class AbstractTgnUser implements java.io.Serializable {

    // Fields

    private Integer inIduser;
    private TgnRole tgnRole;
    private String vcTypeentity;
    private Integer inIdentity;
    private String vcLogin;
    private String vcPwd;
    private String vcName;
    private String vcLastname;
    private String vcMaskcard;
    private String vcLanguage;
    private String vcAttempt;
    private Timestamp dtAttempt;
    private String chChangepwd;
    private String chState;
    private Integer inIduserreg;
    private Timestamp dtRegistry;
    private Integer inIduserupd;
    private Timestamp dtUpdate;
    private Set<TgnPassword> tgnPasswords = new HashSet<TgnPassword>(0);
    private int inAttempt;
    private String vcType;
    private String vcMail;
    // custom


    @Transient
    public int getInAttempt() {
		return Integer.valueOf(((getVcAttempt()==null)?"0":getVcAttempt()));
	}



	/** default constructor */
    public AbstractTgnUser() {
    }

    /** minimal constructor */
    public AbstractTgnUser(Integer inIduser, TgnRole tgnRole,String vcLanguage, String chState,
	    Timestamp dtRegistry, Timestamp dtUpdate) {
	this.inIduser = inIduser;
	this.tgnRole = tgnRole;
	this.vcLanguage = vcLanguage;
	this.chState = chState;
	this.dtRegistry = dtRegistry;
	this.dtUpdate = dtUpdate;
    }

    /** full constructor */
    public AbstractTgnUser(Integer inIduser, TgnRole tgnRole,
	    String vcTypeentity, Integer inIdentity,
	    String vcLogin, String vcPwd, String vcName, String vcLastname,
	    String vcMaskcard, String vcLanguage, String vcAttempt,
	    Timestamp dtAttempt, String chChangepwd, String chState,
	    Integer inIduserreg, Timestamp dtRegistry, Integer inIduserupd,
	    Timestamp dtUpdate, Set<TgnPassword> tgnPasswords) {
	this.inIduser = inIduser;
	this.tgnRole = tgnRole;
	this.vcTypeentity = vcTypeentity;
	this.inIdentity = inIdentity;
	this.vcLogin = vcLogin;
	this.vcPwd = vcPwd;
	this.vcName = vcName;
	this.vcLastname = vcLastname;
	this.vcMaskcard = vcMaskcard;
	this.vcLanguage = vcLanguage;
	this.vcAttempt = vcAttempt;
	this.dtAttempt = dtAttempt;
	this.chChangepwd = chChangepwd;
	this.chState = chState;
	this.inIduserreg = inIduserreg;
	this.dtRegistry = dtRegistry;
	this.inIduserupd = inIduserupd;
	this.dtUpdate = dtUpdate;
	this.tgnPasswords = tgnPasswords;

    }

    // Property accessors
    @Id
    @Column(name = "IN_IDUSER", unique = true, nullable = false)
    public Integer getInIduser() {
	return this.inIduser;
    }

    public void setInIduser(Integer inIduser) {
	this.inIduser = inIduser;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "IN_IDROLE", nullable = false)
    public TgnRole getTgnRole() {
	return this.tgnRole;
    }

    public void setTgnRole(TgnRole tgnRole) {
	this.tgnRole = tgnRole;
    }

   
    @Column(name = "VC_TYPEENTITY", length = 1)
    public String getVcTypeentity() {
	return this.vcTypeentity;
    }

    public void setVcTypeentity(String vcTypeentity) {
	this.vcTypeentity = vcTypeentity;
    }

    @Column(name = "IN_IDENTITY")
    public Integer getInIdentity() {
	return this.inIdentity;
    }

    public void setInIdentity(Integer inIdentity) {
	this.inIdentity = inIdentity;
    }

    @Column(name = "VC_LOGIN", length = 30)
    public String getVcLogin() {
	return this.vcLogin;
    }

    public void setVcLogin(String vcLogin) {
	this.vcLogin = vcLogin;
    }

    @Column(name = "VC_PWD", length = 30)
    public String getVcPwd() {
	return this.vcPwd;
    }

    public void setVcPwd(String vcPwd) {
	this.vcPwd = vcPwd;
    }

    @Column(name = "VC_NAME", length = 60)
    public String getVcName() {
	return this.vcName;
    }

    public void setVcName(String vcName) {
	this.vcName = vcName;
    }

    @Column(name = "VC_LASTNAME", length = 60)
    public String getVcLastname() {
	return this.vcLastname;
    }

    public void setVcLastname(String vcLastname) {
	this.vcLastname = vcLastname;
    }

    @Column(name = "VC_MASKCARD", length = 1)
    public String getVcMaskcard() {
	return this.vcMaskcard;
    }

    public void setVcMaskcard(String vcMaskcard) {
	this.vcMaskcard = vcMaskcard;
    }

    @Column(name = "VC_LANGUAGE", nullable = false, length = 2)
    public String getVcLanguage() {
	return this.vcLanguage;
    }

    public void setVcLanguage(String vcLanguage) {
	this.vcLanguage = vcLanguage;
    }

    @Column(name = "VC_ATTEMPT", length = 2)
    public String getVcAttempt() {
	return this.vcAttempt;
    }

    public void setVcAttempt(String vcAttempt) {
	this.vcAttempt = vcAttempt;
    }

    @Column(name = "DT_ATTEMPT", length = 26)
    public Timestamp getDtAttempt() {
	return this.dtAttempt;
    }

    public void setDtAttempt(Timestamp dtAttempt) {
	this.dtAttempt = dtAttempt;
    }

    @Column(name = "CH_CHANGEPWD", length = 1)
    public String getChChangepwd() {
	return this.chChangepwd;
    }

    public void setChChangepwd(String chChangepwd) {
	this.chChangepwd = chChangepwd;
    }

    @Column(name = "CH_STATE", nullable = false, length = 1)
    public String getChState() {
	return this.chState;
    }

    public void setChState(String chState) {
	this.chState = chState;
    }

    @Column(name = "IN_IDUSERREG")
    public Integer getInIduserreg() {
	return this.inIduserreg;
    }

    public void setInIduserreg(Integer inIduserreg) {
	this.inIduserreg = inIduserreg;
    }

    @Column(name = "DT_REGISTRY", nullable = false, length = 26)
    public Timestamp getDtRegistry() {
	return this.dtRegistry;
    }

    public void setDtRegistry(Timestamp dtRegistry) {
	this.dtRegistry = dtRegistry;
    }

    @Column(name = "IN_IDUSERUPD")
    public Integer getInIduserupd() {
	return this.inIduserupd;
    }

    public void setInIduserupd(Integer inIduserupd) {
	this.inIduserupd = inIduserupd;
    }

    @Column(name = "DT_UPDATE", nullable = false, length = 26)
    public Timestamp getDtUpdate() {
	return this.dtUpdate;
    }

    public void setDtUpdate(Timestamp dtUpdate) {
	this.dtUpdate = dtUpdate;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tgnUser")
    public Set<TgnPassword> getTgnPasswords() {
	return this.tgnPasswords;
    }

    public void setTgnPasswords(Set<TgnPassword> tgnPasswords) {
	this.tgnPasswords = tgnPasswords;
    }


    @Column(name = "VC_TYPE")
    public String getVcType() {
		return vcType;
	}


	public void setVcType(String vcType) {
		this.vcType = vcType;
	}


	@Column(name = "VC_MAIL")
	public String getVcMail() {
		return vcMail;
	}



	public void setVcMail(String vcMail) {
		this.vcMail = vcMail;
	}

    
}